﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Function;

namespace BLL
{
    public class PageQuery2005_BLL
    {
        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param>
        /// <param name="_OverPartitionField">分区字段</param>
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param>
        /// <param name="_OrderField">辅助排序字段</param>
        /// <param name="_GroupField">分组字段</param>
        /// <param name="_HavingField">分组判断条件</param>
        /// <param name="_PageIndex">索引页码</param>
        /// <param name="_PageSize">页长</param>
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverPartitionField, string _OverOrderField, string _OrderField, string _GroupField, string _HavingField, int _PageIndex, int _PageSize, int _PageSizeout, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverPartitionField, _OverOrderField, _OrderField, _GroupField, _HavingField, _PageIndex, _PageSize, PubConstant.GetConnectString(target), out  _strMess);
        }

        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param> 
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param>
        /// <param name="_OrderField">辅助排序字段</param>    
        /// <param name="_GroupField">分组字段</param>
        /// <param name="_HavingField">分组判断条件</param>
        /// <param name="_PageIndex">索引页码</param>
        /// <param name="_PageSize">页长</param>
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverOrderField, string _OrderField, string _GroupField, string _HavingField, int _PageIndex, int _PageSize, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverOrderField, _OrderField, _GroupField, _HavingField, _PageIndex, _PageSize, PubConstant.GetConnectString(target), out  _strMess);
        }


        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param>
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param> 
        /// <param name="_GroupField">分组字段</param>
        /// <param name="_HavingField">分组判断条件</param>
        /// <param name="_PageIndex">索引页码</param>
        /// <param name="_PageSize">页长</param>
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverOrderField, string _GroupField, string _HavingField, int _PageIndex, int _PageSize, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverOrderField, _GroupField, _HavingField, _PageIndex, _PageSize, PubConstant.GetConnectString(target), out  _strMess);
        }


        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param>
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param> 
        /// <param name="_GroupField">分组字段</param>    
        /// <param name="_PageIndex">索引页码</param>
        /// <param name="_PageSize">页长</param>
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverOrderField, string _GroupField, int _PageIndex, int _PageSize, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverOrderField, _GroupField, _PageIndex, _PageSize, PubConstant.GetConnectString(target), out  _strMess);
        }

        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param>
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param>       
        /// <param name="_PageIndex">索引页码</param>
        /// <param name="_PageSize">页长</param>
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverOrderField, int _PageIndex, int _PageSize, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverOrderField, _PageIndex, _PageSize, PubConstant.GetConnectString(target), out  _strMess);
        }


        /// <summary>
        /// sql 2005 通用分页，返回DataTable
        /// </summary>
        /// <param name="_pageCount">返回查询结果集总行数</param>
        /// <param name="_SelectField">查询字段，可以使用sum,count,join等</param>
        /// <param name="_FormTables">查询数据表名，包括架构名</param>
        /// <param name="_WhereField">查询Where条件语句、判断字段，调用的时候不要输入"where"</param>
        /// <param name="_OverOrderField">主排序字段(必填) 如: _Field desc 、_Field asc</param>      
        /// <param name="_connection"></param>
        /// <param name="_strMess"></param>
        /// <returns></returns>
        public static DataTable SelectPage(out int _pageCount, string _SelectField, string _FormTables, string _WhereField, string _OverOrderField, PubConstant.DataBaseTarget target, out string _strMess)
        {
            return DAL.PageQuery2005_DAL.SelectPage(out  _pageCount, _SelectField, _FormTables, _WhereField, _OverOrderField, PubConstant.GetConnectString(target), out  _strMess);
        }
    }
}
